#!/usr/bin/env node
const git = require('./commands/git')
const file = require('./commands/file')
const commander = require('commander')
const shelljs = require('shelljs')

const argv = process.argv
//贴心服务
argv.length <= 2 && shelljs.exec('cli -h')


commander.command('commit [message]')
  .description('git提交,可不填message,默认auto commit')
  .action(message => git.inquirerGitCommit(message))

commander.command('clone [dirname]')
  .description('下载对应模版')
  .action(dirname => git.inquirerGitClone(dirname))

commander.command('del [dirname]')
  .description('删除文件夹')
  .action(dirname => git.inquirerDirDel(dirname))

commander.command('create [dirname]')
  .description('创建git项目')
  .action(dirname => git.inquirerGitCreate(dirname))

commander.command('find')
  .arguments('[dirPath] [goalStr]')
  .description('找到目标代码位置')
  .action((dirPath, goalStr) => file.inquirerFind(dirPath, goalStr))

commander.command('pulls')
  .description('批量拉取代码')
  .arguments('[filename]')
  .action(filename => git.inquirerGitPulls(filename))

commander.command('commits [filename]')
  .description('批量提交,默认auto commit')
  .action(message => git.inquirerGitCommits(message))

commander.parse(process.argv);


